<div class="row">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-header">
                <button class="btn btn-sm btn-primary" ng-click="addTaskUI()">新增任务</button>
                <button class="btn btn-sm btn-primary" ng-click="backupTaskUI()">备份/还原</button>
                <div class="box-tools">
                    <div class="input-group" style="width: 150px;">
                        <input type="text" name="table_search" class="form-control input-sm pull-right"
                               placeholder="搜索">

                        <div class="input-group-btn">
                            <button class="btn btn-sm btn-default"><i class="fa fa-search"></i></button>
                        </div>
                    </div>
                </div>
            </div>
            <!-- /.box-header -->
            <div class="box-body table-responsive no-padding">
                <table class="table table-hover">
                    <tr>
                        <th>操作</th>
                        <th>任务名称</th>
                        <th>任务Bean</th>
                        <th>心跳频率</th>
                        <th>死亡间隔</th>
                        <th>获取数量</th>
                        <th>批量/线程</th>
                        <th>处理模式</th>
                        <th>休眠时长</th>
                        <th>执行时间</th>
                        <th>任务项个数</th>
                        <th>自定义参数</th>
                    </tr>
                    <tr ng-repeat="task in taskList">
                        <td>
                            <button type="button" class="btn btn-success btn-xs" ng-click="editTaskUI(task.baseTaskType,task.dealBeanName,task.heartBeatRate,task.judgeDeadInterval,
                                      task.threadNumber,task.processorType,task.fetchDataNumber,task.executeNumber,
                                      task.sleepTimeNoData,task.sleepTimeInterval,task.permitRunStartTime,task.permitRunEndTime,
                                      task.maxTaskItemsOfOneThreadGroup,task.taskParameter,task.taskItems)">编辑</button>
                            <button type="button" class="btn btn-warning btn-xs" ng-click="clearTask(task.baseTaskType)">清理</button>
                            <button type="button" class="btn btn-danger btn-xs" ng-click="delTaskUI(task.baseTaskType)">删除</button>
                            <button type="button" class="btn btn-info btn-xs" ng-click="getTaskDetail(task.baseTaskType)">查看</button>
                        </td>
                        <td>{{task.baseTaskType}}</td>
                        <td>{{task.dealBeanName}}</td>
                        <td>{{task.heartBeatRate}}</td>
                        <td>{{task.judgeDeadInterval}}</td>
                        <td>{{task.fetchDataNumber}}</td>
                        <td>{{task.executeNumber}}/{{task.threadNumber}}</td>
                        <td>{{task.processorType}}</td>
                        <td>{{task.sleepTimeNoData}}/{{task.sleepTimeInterval}}</td>
                        <td>{{task.permitRunStartTime}}/{{task.permitRunEndTime}}</td>
                        <td>{{task.maxTaskItemsOfOneThreadGroup}}</td>
                        <td>{{task.taskItems}}</td>
                    </tr>

                </table>
            </div>
            <!-- /.box-body -->
        </div>
        <!-- /.box -->
    </div>
</div>


<div class="row">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-header">
                <h3 class="box-title ">{{taskName}}任务详情</h3>

                <div class="box-tools">
                    <button class="btn btn-sm btn-primary" ng-click="addScheduleUI(taskName)">新增策略</button>
                </div>
            </div>
            <!-- /.box-header -->
            <div class="box-body table-responsive no-padding">
                <table class="table table-hover">
                    <tr>
                        <th>管理</th>
                        <th>策略名称</th>
                        <th>任务状态</th>
                        <th>任务类型</th>
                        <th>任务名称</th>
                        <th>任务参数</th>
                        <th>JVM线程组数</th>
                        <th>最大线程组数</th>
                        <th>IP地址</th>
                    </tr>
                    <tr  ng-repeat="strategy in taskDetail.strategyList">
                        <td>
                            <button type="button" class="btn btn-success btn-xs" ng-click="editScheduleUI(strategy.strategyName,strategy.taskName,strategy.sts,strategy.kind,strategy.taskParameter,strategy.numOfSingleServer,strategy.assignNum,strategy.IPList)">编辑</button>
                            <button type="button" class="btn btn-danger btn-xs" ng-click="delScheduleUI(strategy.strategyName,strategy.taskName)">删除</button>
                            <span ng-show="strategy.sts=='resume'">
                                <button type="button" class="btn btn-warning btn-xs" ng-click="startOrStop(strategy.strategyName,strategy.taskName,'pause')">停止</button>
                            </span>
                            <span ng-show="strategy.sts=='pause'">
                                <button type="button" class="btn btn-info btn-xs" ng-click="startOrStop(strategy.strategyName,strategy.taskName,'resume')">恢复</button>
                            </span>
                        </td>
                        <td>{{strategy.strategyName}}</td>
                        <td>{{strategy.sts=='resume'?'正常':'停止'}}</td>
                        <td>{{strategy.kind}}</td>
                        <td>{{strategy.taskName}}</td>
                        <td>{{strategy.taskParameter}}</td>
                        <td>{{strategy.numOfSingleServer}}</td>
                        <td>{{strategy.assignNum}}</td>
                        <td>{{strategy.IPList}}</td>
                    </tr>
                </table>
                <table class="table table-hover" >
                    <tr>
                        <th>线程组编号</th>
                        <th>IP</th>
                        <th>机器名称</th>
                        <th>线程</th>
                        <th>注册时间</th>
                        <th>心跳时间</th>
                        <th>取数时间</th>
                        <th>取数次数</th>
                        <th>取数总量</th>
                        <th>成功总量</th>
                        <th>处理总时</th>
                        <th>处理机器</th>
                    </tr>
                    <tr  ng-repeat="server in taskDetail.scheduleServerList" >
                    <td title="{{server.uuid}}">{{server.uuid| cut:true:10:' ...'}}</td>
                    <td>{{server.ip}}</td>
                    <td>{{server.hostName}}</td>
                    <td>{{server.threadNum}}</td>
                    <td>{{server.registerTime|date: 'yyyy-MM-dd HH:mm:ss'}}</td>
                    <td>{{server.heartBeatTime|date: 'yyyy-MM-dd HH:mm:ss'}}</td>
                    <td>{{server.lastFetchDataTime|date: 'yyyy-MM-dd HH:mm:ss'}}</td>
                    <td>{{server.fetchDataCount}}</td>
                    <td>{{server.fetchDataNum}}</td>
                    <td>{{server.dealDataSucess}}</td>
                    <td>{{server.dealSpendTime}}</td>
                    <td title="{{server.managerFactoryUUID}}">{{server.managerFactoryUUID | cut:true:10:' ...'}}</td>
                    </tr>
                </table>

                <table class="table table-hover" ><tr>
                        <th>任务项</th>
                        <th>当前线程组</th>
                        <th>请求线程组</th>
                        <th>任务状态</th>
                        <th>任务参数</th>
                        <th>处理描述</th>
                    </tr>
                    <tr  ng-repeat="item in taskDetail.taskItemList" >
                        <td>{{$index+1}}</td>
                        <td>{{item.currentScheduleServer}}</td>
                        <td>{{item.requestScheduleServer}}</td>
                        <td>{{item.sts}}</td>
                        <td>{{item.dealParameter}}</td>
                        <td>{{item.dealDesc}}</td>
                    </tr></table>
            </div>
            <!-- /.box-body -->
        </div>
        <!-- /.box -->
    </div>
</div>